package owl2vowl.model.entities;

import owl2vowl.constants.VowlAttribute;
import owl2vowl.model.AbstractVowlObject;
import owl2vowl.model.SetWithoutNull;
import owl2vowl.model.data.VowlGenerationEnum;
import owl2vowl.model.entities.HasEquivalents;
import owl2vowl.model.entities.HasSubEntities;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.semanticweb.owlapi.model.IRI;

public abstract class AbstractEntity extends AbstractVowlObject implements HasEquivalents, HasSubEntities {
	private String type;
	private Set<VowlAttribute> attributes = new HashSet();
	private Set<IRI> equivalents = new SetWithoutNull();
	private List<IRI> sortedEquivalents = new ArrayList();
	private Set<IRI> subEntities = new SetWithoutNull();
	private Set<IRI> superEntities = new SetWithoutNull();
	private VowlGenerationEnum generated;
	private boolean exportToJson;

	protected AbstractEntity(IRI iri, String type) {
		super(iri);
		this.generated = VowlGenerationEnum.AUTOMATIC;
		this.exportToJson = true;
		this.type = type;
	}

	public List<IRI> getSortedEquivalents() {
		return Collections.unmodifiableList(this.sortedEquivalents);
	}

	public void setSortedEquivalents(List<IRI> sortedEquivalents) {
		this.sortedEquivalents = sortedEquivalents;
	}

	public VowlGenerationEnum getGenerated() {
		return this.generated;
	}

	public void setGenerated(VowlGenerationEnum generated) {
		this.generated = generated;
	}

	public Set<VowlAttribute> getAttributes() {
		return Collections.unmodifiableSet(this.attributes);
	}

	public void addAttribute(VowlAttribute attribute) {
		this.attributes.add(attribute);
	}

	public String getType() {
		return this.type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public Set<IRI> getEquivalentElements() {
		return Collections.unmodifiableSet(this.equivalents);
	}

	public void addEquivalentElement(IRI iri) {
		this.equivalents.add(iri);
	}

	public boolean equals(Object o) {
		if (this == o) {
			return true;
		} else if (o != null && this.getClass() == o.getClass()) {
			boolean arg9999;
			label35 : {
				AbstractEntity that = (AbstractEntity) o;
				if (this.iri != null) {
					if (this.iri.equals(that.iri)) {
						break label35;
					}
				} else if (that.iri == null) {
					break label35;
				}

				arg9999 = false;
				return arg9999;
			}

			arg9999 = true;
			return arg9999;
		} else {
			return false;
		}
	}

	public int hashCode() {
		return this.iri != null ? this.iri.hashCode() : 0;
	}

	public String toString() {
		return this.iri.toString();
	}

	public Set<IRI> getSuperEntities() {
		return Collections.unmodifiableSet(this.superEntities);
	}

	public void addSuperEntity(IRI iri) {
		this.superEntities.add(iri);
	}

	public Set<IRI> getSubEntities() {
		return Collections.unmodifiableSet(this.subEntities);
	}

	public void addSubEntity(IRI iri) {
		this.subEntities.add(iri);
	}

	public boolean isExportToJson() {
		return this.exportToJson;
	}

	public void setExportToJson(boolean exportToJson) {
		this.exportToJson = exportToJson;
	}
}